using UnityEngine;

[ExecuteInEditMode]
public class ControllerPlatformMobileTarget : ControllerGeneric
{
	private float unit = 0.5f;

	public float lungime = 1f;

	public float latime = 1f;

	public GameObject cub;

	public RemoteControl platformRC;

	private void Update()
	{
		if (!Application.isEditor || Application.isPlaying)
		{
			return;
		}
		if (platformRC == null)
		{
			Object.DestroyImmediate(base.gameObject);
			return;
		}
		SetupRemoteControl();
		if (IsRemoteControlActive())
		{
			remoteControl.transform.rotation = platformRC.transform.rotation;
			remoteControl.transform.localScale = platformRC.transform.localScale;
			base.transform.position = remoteControl.transform.position;
			base.transform.rotation = remoteControl.transform.rotation;
			lungime = remoteControl.transform.localScale.z;
			latime = remoteControl.transform.localScale.x;
		}
		Setup();
	}

	private void Setup()
	{
		AssureParenting();
		cub.transform.localPosition = new Vector3(0f, (0f - ControllerGeneric.floorHeight) * 0.5f, 0f);
		cub.transform.localEulerAngles = Vector3.zero;
		cub.transform.localScale = new Vector3(latime, ControllerGeneric.floorHeight / 0.25f, lungime);
	}

	public void SetupRemoteControl()
	{
		if (remoteControl == null)
		{
			InitRemoteControl();
			remoteControl.gameObject.name = remoteControl.gameObject.name + base.name;
			remoteControl.gameObject.transform.position = base.transform.position;
			remoteControl.gameObject.transform.rotation = base.transform.rotation;
			remoteControl.gameObject.transform.localScale = new Vector3(latime, unit, lungime);
			remoteControl.destroyable = false;
			remoteControl.duplicable = false;
		}
	}

	public void SetupUVs()
	{
	}
}
